/*
 * @(#)AvailabilityStatus.java
 * Date 2013-08-30
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.registry.constant;

/**
 * Enum description
 *
 */
public enum AvailabilityStatus {

    Approved("urn:oasis:names:tc:ebxml-regrep:StatusType:Approved"), 
    Deprecated("urn:oasis:names:tc:ebxml-regrep:StatusType:Deprecated"), 
    Submitted("urn:oasis:names:tc:ebxml-regrep:StatusType:Submitted"), 
    Withdrawn("urn:oasis:names:tc:ebxml-regrep:StatusType:Withdrawn");

    /** Field description */
    private final String code;

    /**
     * Constructs ...
     *
     *
     * @param code
     */
    private AvailabilityStatus(String code) {
        this.code = code;
    }

    /**
     * Method description
     *
     *
     * @param code
     *
     * @return
     */
    public static AvailabilityStatus toAvailabilityStatus(String code) {

        AvailabilityStatus result = null;

        for (AvailabilityStatus mycode : values()) {

            if (mycode.code.equals(code)) {

                result = mycode;

                break;
            }
        }

        return result;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getCode() {
        return this.code;
    }
}
